package com.ruoyi.recycle.factory;

import com.ruoyi.recycle.constant.OrderInfoConstant;
import com.ruoyi.recycle.service.ExchangeRecordService;
import com.ruoyi.recycle.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

@Configuration
public class OrderFactoryConfiguration {
    @Autowired
    private ExchangeRecordService exchangeRecordService;

    @Bean
    public OrderFactory create() {
        final OrderFactory factory = new OrderFactory();
        Map<String, OrderService> factoryMap = new HashMap<>();
        factoryMap.put(OrderInfoConstant.CHARGE_ORDER, exchangeRecordService);
        factory.setOrderServiceMap(factoryMap);
        return factory;
    }
}
